﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using spbtzb;

public partial class Back_CopyRightConf : System.Web.UI.Page
{
    private Boolean session_Logined
    {
        set
        {
            Session["Logined"] = value;
        }
        get
        {
            return Session["Logined"] == null ? false : Convert.ToBoolean(Session["Logined"]);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    { 
        this.Page.Title = "版权信息管理界面";
        if (!Page.IsPostBack)
        {
            if (session_Logined == false)
            {
               // Response.Redirect("Login.aspx?ErrorMessage=" + "您未登录，请在此登录");
            }
           
            String strCRInfo = ConfigurationManager.AppSettings["CopyRight"];
            this.tb_OldInfo.Text = spbtzb.AuthenCtr.Decode(strCRInfo);
        }

    }
    protected void btn_Cancle_Click(object sender, EventArgs e)
    {
        Response.Redirect("BgArticleList.aspx");
    }
    protected void btn_Submit_Click(object sender, EventArgs e)
    {
        String strCRInfo = ConfigurationManager.AppSettings["CopyRight"];
        try
        {
            String[] strKeys = { "CopyRight"};
            String[] strValues = {AuthenCtr.Encode(tb_NewInfo.Text) }; //don't trim
            AuthenCtr.ModifyEx(strKeys, strValues);
            RegisterClientScriptBlock("tip", "<script>alert('恭喜，版权信息修改成功');</script>");
        }
        catch
        {
            RegisterClientScriptBlock("tip", "<script>alert('操作失败，请重新操作或联系管理员');</script>");
        }  
    }
}
